Skip to content

Add support for Zipper.find_all/3 - #163

Merged
doorgan merged 1 commit into
doorgan:mainfrom
bcardarella:bc-zipper-find-all
Aug 10, 2024
Merged

Add support for Zipper.find_all/3#163
doorgan merged 1 commit into
doorgan:mainfrom
bcardarella:bc-zipper-find-all

Conversation

@bcardarella

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread test/zipper_test.exs
|> Z.next()
|> Z.next()
|> Z.next()
|> Z.next()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there is a better way to get to the last node let me know. I tried Zipper.rightmost but I think that only goes to the right most of the current node

@bcardarella

Copy link
Copy Markdown
Contributor Author

FYI unrelated tests failing with Elixir 1.17

  1) test get_range/1 bitstrings (SourcerorTest.RangeTest)
     test/range_test.exs:1041
     Assertion with == failed
     code:  assert decorate(code, to_range(code)) == "«<<1, 2,\n\n foo>>»\n" |> String.trim_trailing()
     left:  "«<<1, 2,\n\n foo>>\n»"
     right: "«<<1, 2,\n\n foo>>»"
     stacktrace:
       test/range_test.exs:1051: (test)

......

  2) test get_range/1 anonymous functions (SourcerorTest.RangeTest)
     test/range_test.exs:664
     Assertion with == failed
     code:  assert decorate(code, to_range(code)) == "«fn ->\n  :ok\nend»\n" |> String.trim()
     left:  "«fn ->\n  :ok\nend\n»"
     right: "«fn ->\n  :ok\nend»"
     stacktrace:
       test/range_test.exs:674: (test)

................................................................................................................................................................

  3) test get_end_position/2 returns the correct positions (SourcerorTest)
     test/sourceror_test.exs:546
     Assertion with == failed
     code:  assert Sourceror.get_end_position(quoted) == [line: 3, column: 1]
     left:  [line: 3, column: 3]
     right: [line: 3, column: 1]
     stacktrace:
       test/sourceror_test.exs:565: (test)

.

  4) doctest Sourceror.get_end_position/2 (20) (SourcerorTest)
     test/sourceror_test.exs:7
     Doctest failed
     doctest:
       iex> quoted = ~S"""
       ...> foo do
       ...>   :ok
       ...> end
       ...> """ |>  Sourceror.parse_string!()
       iex> Sourceror.get_end_position(quoted)
       [line: 3, column: 1]
     code:  Sourceror.get_end_position(quoted) === [line: 3, column: 1]
     left:  [line: 3, column: 3]
     right: [line: 3, column: 1]
     stacktrace:
       lib/sourceror.ex:562: Sourceror (module)

@bcardarella

Copy link
Copy Markdown
Contributor Author

force pushed format fix for CI

@doorgan doorgan left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

About the 1.17 test issues, it seems some bugs in the elixir parser were fixed in core elixir. We can either backport those fixes in a new PR, or adopt lib_elixir(I have a POC here but there's some polishing needed to make it work appropriately)

@doorgan
doorgan merged commit c6b0cd9 into doorgan:main Aug 10, 2024
@bcardarella
bcardarella deleted the bc-zipper-find-all branch August 10, 2024 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants